package com.lyb.mapper;

import com.lyb.Dto.UserDto;
import com.lyb.pojo.User;
import com.lyb.services.impl.UserServiceImpl;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface UserMapper {
    User getUserByName(String name);
    @Insert("insert into user (name,password) values (#{user.name},#{user.password})")
    Boolean register(@Param("user") UserDto user);
    @Select("select * from user")
    List<User> queryPage();
    @Update("update user set name=#{user.name} where id=#{user.id}")
    Boolean update(@Param("user") User user);
    @Delete("delete from user where id=#{id}")
    Boolean del(Long id);
    @Insert("insert into user (name,password) values (#{user.name},#{user.password})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void add(@Param("user") User user);
}
